package cn.lyn4ever.blogdemo.dowithoutifelse.controller;

import cn.lyn4ever.blogdemo.dowithoutifelse.bean.Order;
import cn.lyn4ever.blogdemo.dowithoutifelse.config.SpingContext;
import cn.lyn4ever.blogdemo.dowithoutifelse.service.OrderService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 微信公众号 “小鱼与Java”
 *
 * @date 2020/5/18
 * @auther Lyn4ever
 */
@RestController
public class OrderController {


    private String orderServiceBeanNamePrefix = "orderService";

    @RequestMapping("getOrderList/{zt}")
    public List<Order> getOrderList(@PathVariable("zt") String zt) {

        //获取对应的处理状态的bean
        OrderService orderService = (OrderService) SpingContext.getBean(orderServiceBeanNamePrefix + zt);
        List<Order> orderList = orderService.getOrderList();

        return orderList;
    }
}
